{extend name="ace/layout/master/detail" /}

{block name="title"}菜单管理{/block}

{block name="page-title"}菜单{/block}

{block name="content"}
<input name="menu_id" class="form-control" type="hidden" value="{if $detail}{$detail->menu_id}{/if}" />
<div class="form-group">
    <label class="col-sm-3 control-label no-padding-right"> 父级栏目： </label>
    <div class="col-sm-9">
        <?php $parent_id = input('parent_id', 0);?>
        <select name="parent_id" class="col-xs-10 col-sm-5">
            <option value="0">--默认顶级--</option>
            {if $menus}
                {foreach $menus as $menu}
                    <option value="{$menu['menu_id']}"
                            {if $detail}
                                {$menu['menu_id'] == $detail->parent_id ? 'selected' : ''}
                            {else /}
                                {$menu['menu_id'] == $parent_id ? 'selected' : ''}
                            {/if}
                             > {$menu['menu_name']} </option>
                    {if !empty($menu['_child'])}
                        {foreach $menu['_child'] as $child}
                            <option value="{$child['menu_id']}"
                                    {if $detail}
                                        {$child['menu_id'] == $detail->parent_id ? 'selected' : ''}
                                    {else /}
                                        {$child['menu_id'] == $parent_id ? 'selected' : ''}
                                    {/if}
                                        >├─{$child['menu_name']} </option>
                        {/foreach}
                    {/if}
                {/foreach}
            {/if}
        </select>
    </div>
</div>
<div class="space-4"></div>
<div class="form-group">
    <label class="col-sm-3 control-label no-padding-right"> 菜单名称： </label>
    <div class="col-sm-9">
        <input type="text" name="menu_name" placeholder="输入菜单名称" class="col-xs-10 col-sm-5" required="" value="{if $detail}{$detail->menu_name}{/if}" />
        <span class="lbl col-xs-12 col-sm-7">
                <i class="icon-info-sign"></i> 唯一标识
            </span>
    </div>
</div>
<div class="space-4"></div>
<div class="form-group">
    <label class="col-sm-3 control-label no-padding-right"> 页面路由： </label>
    <div class="col-sm-9">
        <input type="text" name="menu_url" placeholder="输入页面路由" class="col-xs-10 col-sm-5" value="{if $detail}{$detail->menu_url}{/if}" />
        <span class="lbl col-xs-12 col-sm-7">
            <i class="icon-info-sign"></i> 可为空！【后端访问页面】
        </span>
    </div>
</div>
<div class="space-4"></div>
<div class="form-group">
    <label class="col-sm-3 control-label no-padding-right"> 图标： </label>
    <div class="col-sm-9">
        <input type="text" name="menu_icon" placeholder="输入图标" class="col-xs-10 col-sm-5" value="{if $detail}{$detail->menu_icon}{/if}" />
        <span class="lbl col-xs-12 col-sm-7">
            <i class="icon-info-sign"></i> 选择图标 如:icon-list
        </span>
    </div>
</div>
<div class="space-4"></div>
<div class="form-group">
    <label class="col-sm-3 control-label no-padding-right"> 排序： </label>
    <div class="col-sm-9">
        <input type="text" name="menu_sort" class="col-xs-10 col-sm-5" value="{if $detail}{$detail->menu_sort}{/if}" />
        <span class="lbl col-xs-12 col-sm-7">
            <i class="icon-info-sign"></i> 排序从小到大
        </span>
    </div>
</div>
<div class="space-4"></div>
<div class="form-group">
    <label class="col-sm-3 control-label no-padding-right">
        是否左侧栏目展示：
    </label>
    <div class="col-sm-9 radio">
        <label>
            <input name="is_left" type="radio" class="ace" value="1" {if (empty($detail) || $detail->is_left === 1) }checked{/if} />
            <span class="lbl"> 是 </span>
        </label>
        <label>
            <input name="is_left" type="radio" class="ace" value="0" {if (empty($detail) || $detail->is_left === 0) }checked{/if} />
            <span class="lbl"> 否 </span>
        </label>
    </div>
</div>
<div class="space-4"></div>
<div class="form-group">
    <label class="col-sm-3 control-label no-padding-right">
        是否启用：
    </label>
    <div class="col-sm-9 radio">
        <label>
            <input name="is_check" type="radio" class="ace" value="1" {if (empty($detail) || $detail->is_check === 1) }checked{/if} />
            <span class="lbl"> 启用 </span>
        </label>
        <label>
            <input name="is_check" type="radio" class="ace" value="0" {if (empty($detail) || $detail->is_check === 0) }checked{/if} />
            <span class="lbl"> 禁用 </span>
        </label>
    </div>
</div>
{/block}

{block name="script"}
<script type="text/javascript">
    window.onload = function () {
        closeLayerLoading(closeAllLayer);
    }
</script>
{/block}